package com.sysu.minsysu.zxcx;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;

import com.sysu.minsysu.R;
import com.sysu.minsysu.zxcx.NewsNetwork.LinkNode;

public class ShowArticle extends Activity{

	LinkNode mLinkNode;
	
	TextView mTitleTextView;
	TextView mContentTextView;
	
	String mContentText;
	
	@Override
	public void onCreate( Bundle savedInstance ){
		super.onCreate(savedInstance);
		setContentView(R.layout.showarticle);
		
		mTitleTextView = (TextView)findViewById(R.id.title);
		mContentTextView = (TextView)findViewById(R.id.content);
		mLinkNode = (LinkNode)getIntent().getSerializableExtra("linknode");
		
		if( mLinkNode==null)
			return ;
		
		mTitleTextView.setText(mLinkNode.title);
		(new Handler(){
			@Override
			public void handleMessage( Message message){
				mContentText = NewsNetwork.getArticleContent(mLinkNode.link);
				mContentTextView.setText(mContentText);
			}
		}).sendEmptyMessage(0);
	}
}
